import React, {Component} from 'react';
import Item from "../Item";
import './index.css'
import PropTypes from "prop-types";

class List extends Component {
    static propTypes = {
        todos: PropTypes.array.isRequired,
        changeTodo: PropTypes.func.isRequired,
        deleteTodo: PropTypes.func.isRequired
    }

    render() {
        const {todos} = this.props
        return (
            <ul className="todo-main">
                {
                    todos.map(item => {
                        return <Item deleteTodo={this.props.deleteTodo} changeTodo={this.props.changeTodo}
                                     itemValue={item} key={item.id}/>
                    })
                }

            </ul>
        );
    }
}

export default List;